package cn.itcast.dao;


import cn.itcast.pojo.User;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import cn.itcast.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;

public interface UserDao {

    //根据条件查询
    Page<User> selectByCondition(String queryString);

    //根据id查询用户
    User findUserById(Integer userId);

    //根据id查询Roles List<Integer> Integer[]
    ArrayList<Integer> findRolesById(Integer userId);

    //添加用户
    boolean add(User user);

    //向中间表插入关联id
    boolean insertUserAndRoleId(@Param("userId") Integer userId, @Param("roleId") Integer roleId);

    //修改用户
    boolean updateUser(User user);

    //删除用户
    boolean deleteUser(Integer userId);

    //根据UserId删除中间表数据
    void deleteUserAndRoleId(Integer userId);


    User findByUsername(String username);


}
